home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The X-Philes (2nd Revision)
/
The X-Philes Number 1 (1995).iso
/
xphiles
/
hp48_1
/
pubdom.tar
/
pubdom
/
rbj
/
myr
< prev
next >
Wrap
Text File
|
1990-05-09
|
4KB
|
59 lines
%%HP: T(3)A(D)F(.);
@ MYR Display a calendar for a month/year: month year MYR
@ RBJ 4/16/90 Initial Code
@ 4/19/90 Replaced list of "dd" string with computed CROW function
@ 4/23/90 Moved code inline, local function g (old CROW), p
@ removed utility function "library, use SUB string in
@ local function g for SPEED. One character local variables
@ 4/24/90 Improved annotation
@ 4/25/90 Revised day of week, eliminate extra ->STR
@ 5/08/90 Use Flag 9 vs 1 for printer control , elim F2
@
@ User Flags: F9: If set sends text lines to printer
\<< @ month year -> display
\<< @ Local Function 'g' b e -> "b..e"
@ Returns row of calendar. This
" 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 " @ should be 1 string,
"16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31" + @ but avoid wrap on PC
ROT 3 * 2 - ROT 3 * 1 - SUB @ Extract desired part of string
\>>
\<< @ Local function 'p' PRT/DISP
IF DUP TYPE 7 == @ If local name (the row number)
THEN INCR OVER SWAP DISP END @ Increment row & display
IF 9 FS? THEN PR1 END @ Print if requested by Flag 9
DROP @ Drop String (Was retained by F2)
\>> @ CREATE LOCALS:
RCLF 0 0 0 1 0 0 \-> m y g p @ month, year, func g, func p,
f d n i b e r @ flags, date, ndays, indent,
@ begin, end, screen row
\<< @ THE REAL PROGRAM
y 1E6 / m + .01 + DUP 'd' STO @ Date first of month
10.171582 SWAP DDAYS 7 MOD @ Day of Week (0..6 for SMTWTFS)
'i' STO @ Number of days to indent
IF m 12 == @ Figure number of days in month
THEN 31 ELSE d DUP 1 + DDAYS @ where December is special case
END 'n' STO @ Store as n
CLLCD " " @ Centering string
"JanFebMarAprMayJunJulAugSepOctNovDec" @ Month Names
m 3 * DUP 2 - SWAP SUB @ Extract correct portion
+ " " + STD y + @ Now have the Month Year string
'r' p EVAL @ 'Row' Prt/Disp
" S M T W T F S"
IF n i + 35 \<= @ Only Display if it fits
THEN 'r' END p EVAL
7 i - 'e' STO @ Dates first row (b set above)
i 3 * @ Generate indent string
" " DUP + 1 ROT SUB @ Nblank function inline
b e g EVAL + @ First row
'r' p EVAL @ 'Row'Prt/Disp
DO
e 1 + 'b' STO @ Start of next row
e 7 + n MIN 'e' STO @ End of next row
b e g EVAL @ Generate next row
'r' p EVAL @ 'Row' Prt/Disp
UNTIL e n == END @ Until listed last day of month
3 FREEZE @ Hold screen
f STOF @ Restore Flags
\>>
\>>